package me.ingxin.android.router.route

import android.content.Context
import me.ingxin.android.router.annotaions.route.IRouteInterceptor

/**
 * Created by ingxin on 2022/4/18
 */
interface RouteInterceptor : IRouteInterceptor {

    /**
     * 路由拦截处理
     * @param context 发起路由时的上下文
     * @param request 路由请求
     * @param dispatcher 拦截器流程调度
     */
    fun handle(context: Context, request: Request, dispatcher: Dispatcher)

    /**
     * 拦截器分发
     */
    interface Dispatcher {

        /**
         * 路由继续执行
         */
        fun continueRun()

        /**
         * 路由中断
         */
        fun interrupt()
    }

}